package com.dykj.fireFighting.server.fire.matterManagement.service.impl;





import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dykj.fireFighting.api.fire.matterManagement.dto.ToDoListDto;
import com.dykj.fireFighting.api.fire.matterManagement.entity.ToDoList;
import com.dykj.fireFighting.api.fire.matterManagement.service.IToDoListService;
import com.dykj.fireFighting.common.core.service.impl.BaseServiceImpl;
import com.dykj.fireFighting.common.core.vo.PageVo;
import com.dykj.fireFighting.server.fire.matterManagement.mapper.ToDoListMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 维保app待办事项
 *
 * @Author JacksonTu
 * @Date  2021-09-01 08:58:19
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class ToDoListServiceImpl extends BaseServiceImpl<ToDoListMapper, ToDoList> implements IToDoListService {


    @Override
    public void deleteByIds(List<String> asList) {
        this.baseMapper.deleteByIds(asList);
    }

    @Override
    public PageVo<ToDoList> queryList(ToDoListDto toDoListDto) {
        HashMap<String, Object> params = new HashMap<>(16);
        params.put("unitId",toDoListDto.getUnitId());
        Page page = new Page();
        // 设置当前页码
        page.setCurrent(toDoListDto.getPage());
        // 设置页大小
        page.setSize(toDoListDto.getLimit());

        return new PageVo<ToDoList>(this.baseMapper.queryList(page,params));
    }
}
